#pragma once
#include "stdafx.h"
#include "ISensorReader.h"
#include <list>
#include <memory>
#include "ISensorReaderListener.h"
#include "SerialPortReader.h"

namespace Sensor {

	class SensorReader : public ISensorReader {
	private:
		SerialPortReader serialPortReader;

		std::list<ISensorReaderListener*> listeners;
		HANDLE thread;

		std::list<std::unique_ptr<IReading>> parseInputString(std::string line) const;
	public:
		SensorReader();
		~SensorReader();
		virtual void start();
		virtual void stop();
		void update();
		virtual void addListener(ISensorReaderListener* listener);
		virtual void removeListener(ISensorReaderListener* listener);
	};

}